home *** CD-ROM | disk | FTP | other *** search
-
- - THE OUTLAW TRIAD DEMO-SERIES -
-
- ────────────────────────────────■ PART VII ■───────────────────────────────────
-
- Written by : Vulture/OT
- Code in : Assembler
- Topic : Plasmas
-
- ──────────────────────────────■ Introduction ■─────────────────────────────────
-
- Welcome to the Outlaw Triad demo-series! In these series we will be talking
- about programming demo-effects in either pascal or assembler. Theory behind
- the effects shall be discussed while a full sourcecode is also provided.
- This time a VERY wellknown type of effect is discussed and that is plasmas!
- Plasmas are great for background effects. For example, when displaying some
- text, you could run a plasma screen in the background. Let's see how plasma
- screens are made. Enjoy!
-
- ─────────────────────────────────■ Theory ■────────────────────────────────────
-
- Note: I know plasmas are very old and shouldn't be used too much nowadays
- but I think plasmas are great for learning purposes. That's the reason why
- I decided to put a plasma trainer into these series anyway.
-
- Let's start by mentioning the diverence between 2 sorts of plasmas. Static
- plasma and realtime plasma. The first variant simply creates a screen on
- which pixels fluently flow into other colors. Then the palette is rotated.
- Realtime plasma uses cosine values to create magnificient curves on the vga
- thus being much more fun to watch than static plasma, IMHO. But, realtime
- plasma is more time consuming than static plasma because each pixel on the
- screen has to be refreshed each frame!
-
- To create a plasma screen you should use an unchained tweaked vga mode.
- Because every pixel on the screen is affected each frame, it is usually
- best to reprogram the vga to a mode in which you have large pixels, let's
- say 4x4. This will result in mode 80x50 so we only have to process 80*50=
- 4000 pixels each frame. Also create a good palette. The colors should run
- smoothly from one to the other.
-
- To create realtime plasma, we need cosine values. Why? Because cosine values
- represent a nice curve and that's what we want, nice curves. Take a look at
- the source to see a good cosine chart. Oh, that chart was generated by Jare/
- VangelisTeam (always give credit where credit is due), but it's pretty easy
- to generate your own charts. The values in this example range from 0 to 64
- but of course you can go and experiment with other values/ranges. The range
- in this example is pretty clever. Think about it! When you add 4 cosine
- values in range 0..64, the maximum value you can get is 4*64=256. And that's
- the exact amount of colors we have to our disposal in plain mode 13h.
- In this example I only used 128 colors. The cosine values go up to 64 so I
- had to implement code to handle additions above 128.
-
- Anyway, now we have setup our vga and created a good cosine chart. Let's go
- and code the plasma. We want complex curves on the screen. To create plasma
- screens, we simply add 4 cosine values and put the resulting value on the
- vga. We use 2 cosine values for vertical movement and 2 for the horizontal
- movement. For each frame we use 4 pointers to the cosine chart. For each
- horizontal pixel, we update our 2 horizontal cosine pointers to point to
- another cosine value in the chart! For each horizontal line we go down we
- update our 2 vertical pointers. When updating the pointers, don't save the
- new values to the pointer variables but into temporary variables (in asm I
- just used some registers). We update the original pointers when we've done
- the entire screen (frame). Complex? Observe this:
-
- - Set vertical cosine start values (save into temp variables)
- - Go into vertical loop (50 times in this example)
- - Set horizontal cosine start values (save into temp variables)
- - Go into horizontal loop (80 times in this example)
- - Add 4 temporary cosine values
- - Put result on vga
- - Update the temporary horizontal cosine values
- - End horizontal loop
- - Update the temporary vertical cosine values
- - End vertical loop
- - Update the original cosine start values
- - Back to start
-
- Just take a look at the source to see what I mean. Go and change some of the
- values and see what happens. Also, try to implement this in hi-resolutions
- to see what you get. Allthough it's a rather old effect, it still is good
- enough to put in demos when you use it clever enough. I know this text is
- a bit cryptic but once you've experimented with the source, all will become
- clear. Trust me ... I know ... :-)
-
- Ok, this is all for now. Happy coding!
-
- -Vulture/Outlaw Triad-
-
- ───────────────────────────────■ Distro Sites ■────────────────────────────────
-
- Call our distrobution sites! All our releases are available at:
-
- BlueNose World HQ +31 (0)345-619401
- The Force Distrosite +31 (0)36-5346967 More distros wanted!
- Bugs'R'Us Distrosite +31 (0)252-686092 (preferably outside
- MagicWare Italian HQ +39 6-52355532 of The Netherlands)
- ShockWave South African HQ +27 (011)888-6345
- Society HQ United States HQ +1 (518)465-6721
-
- Also check the major FTP sites for Outlaw Triad productions.
-
- ──────────────────────────────────■ Contact ■──────────────────────────────────
-
- Want to contact Outlaw Triad for some reason? You can reach us at our
- distrosites in Holland. Or if you have e-mail access, mail us:
-
- Vulture (coder/pr) comma400@tem.nhl.nl
-
- Our internet homepage:
-
- http://www.tem.nhl.nl/~comma400/vulture.html
-
- These internet adresses should be valid at least till june 1997.
-
- ──────────────────────────────────────────────────────────────────────────────
-
- Quote: It is dangerous to be sincere unless you are also stupid.
-